package com.yonyou.ucf.mdf.query.core.executor;

import com.yonyou.diwork.service.IApplicationCacheService;
import com.yonyou.iuap.context.InvocationInfoProxy;
import com.yonyou.ucf.mdd.api.interfaces.rpc.IComQueryApi;
import com.yonyou.ypd.bill.basic.spring.YpdSpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author: zhuyjh
 * @Date: 2024/8/6 16:00
 */
public class IsvRemoteQueryExecutor extends RemoteQueryExecutor{
    private Class<?> queryApiClass;
    private Class<?> billContextClass;

    public IsvRemoteQueryExecutor() {
        init();
    }
    @SuppressWarnings ("uncheckClassLoader")
    private void init(){
        try {
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            this.queryApiClass = classLoader.loadClass("com.yonyou.ucf.mdd.api.interfaces.rpc.IComQueryApi");
            this.billContextClass = classLoader.loadClass("com.yonyou.ucf.mdd.ext.model.BillContext");
        } catch (Exception e) {
            throw new RuntimeException("构造RemoteQueryExecutor 失败", e);
        }
    }
    protected Object getRemoteCommonQueryService(String domain) {
        //判断domain是不是同domain，不是则走isv
        InvocationInfoProxy.setExtendAttribute("isvdomain",domain);
        return YpdSpringContextHolder.getContext().getBean(IComQueryApi.class);
    }
}